package com.ctibook.booksystem.dao.bookcatalog.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.cti.ftpservice.dao.impl.BaseDao;
import com.ctibook.booksystem.dao.bookcatalog.BookInfoPublisherDao;
import com.ctibook.booksystem.model.bookcatalog.BookInfoPublisher;

@Repository("bookInfoPublisherDao")
public class BookInfoPublisherDaoImpl extends BaseDao implements BookInfoPublisherDao {

	@Override
	public void addOrUpdateBookinfoPublisher(BookInfoPublisher bookInfoPublisher) {
		addOrUpdateObj(bookInfoPublisher);
	}

	@Override
	public void deleteBookinfoPublisher(BookInfoPublisher bookInfoPublisher) {
		deleteObj(bookInfoPublisher);
	}

	@Override
	public BookInfoPublisher getById(String id) {
		return getModel(BookInfoPublisher.class, id);
	}

	@Override
	public BookInfoPublisher getByName(String name) {
		String hql=" from "+BookInfoPublisher.class.getName()+" t where t.name=:name";
		Map<String, Object> maps=new HashMap<String, Object>();
		maps.put("name", name);
		return getSingleObject(hql, maps);
	}

	@Override
	public List<BookInfoPublisher> getAllPublisher() {
		String hql=" from "+BookInfoPublisher.class.getName()+" t";
		return getListObject(hql);
	}

}
